# Form 用于生标准的表单
# ModelForm 用于从模型中生成表单
from django import forms
from blog.models import Comment


class EmailPostForm(forms.Form):
    # charfield 会被渲染成<input type="text">
    name = forms.CharField(max_length=25)
    email = forms.EmailField()
    to    = forms.EmailField()
    # widget参数决定该字段被渲染成的html元素类型 Textarea <textarea>
    comments = forms.CharField(required=False, widget=forms.Textarea)


class CommentForm(forms.ModelForm):
    class Meta:
        model = Comment
        fields = ("name", "email", "body")


